#include "ppv.h"

int unppv(int* V, int* TV, int L, int Nb){
  int i=0;
  double k=2.0;
  double min=distance(V, &(TV[i*L]), k);
  double next=0.0;
  int res=i;
  i++;
  while(i!=Nb){
    next=distance(V, &(TV[i*L]), k);
    if(min>next){
      min=next;
      res=i;
    }
    i++;
  }
  return res*L;
}
